package com.maxatime.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.maxatime.dao.kaoshiMapper;
import com.maxatime.pojo.entity.kaoshi;
import com.maxatime.service.Ssbkaoshi2;

@Service
public class SsbkaoshiImpl2 implements Ssbkaoshi2{

	@Autowired
	kaoshiMapper kaoshiMapper;
	
	//查询
	@Override
	public List<kaoshi> listData(kaoshi kaoshi) {
		// TODO Auto-generated method stub
		List<kaoshi> list = kaoshiMapper.listData2(kaoshi);
		return list;
	}

	@Override
	public int insertSelective(kaoshi record) {
		// TODO Auto-generated method stub
		Date d = new Date();
		kaoshi kaoshi1 = new kaoshi();
		BeanUtils.copyProperties(record, kaoshi1);
		kaoshi1.setCreateTime(d);
		kaoshi1.setUpdateTime(d);
		kaoshi1.setDeleteFlag("0");
		kaoshiMapper.insertSelective(kaoshi1);
		return 0;
	}

	@Override
	public int deleteByPrimaryKey(int pkid) {
		// TODO Auto-generated method stub
		
		return kaoshiMapper.deleteByPrimaryKey(pkid);
	}

	@Override
	public kaoshi findpkid(int pkid) {
		// TODO Auto-generated method stub
		
		
		return kaoshiMapper.findpkid(pkid);
	}

	@Override
	public kaoshi update(kaoshi record) {
		// TODO Auto-generated method stub
		kaoshi kaoshi = new kaoshi();
		BeanUtils.copyProperties(record, kaoshi);
		Date date = new Date();
		kaoshi.setUpdateTime(date);
		return kaoshiMapper.updateByPrimaryKeySelective(record);
	}

}
